/* eslint-disable */
import { setData } from "../storage.js";
import { ACCESS_TOKEN } from "./dToken.js";
import vueBus from "../bus"
const login = [];
const loginOut = [];
const codeLogin = 401;
let setToken = function (res) {
    if (login.indexOf(res.config.url) != -1) {
        if (res.data.code == 200) {
            vueBus.$emit("routes", [1, 2, 4])
            let obj = {};
            obj[ACCESS_TOKEN] = res.data.data
            setData(obj)
        }
    }
}
let rmToken = function (res) {
    if (loginOut.indexOf(res.config.url) != -1) {
        let obj = {};
        obj[ACCESS_TOKEN] = null;
        setData(obj)
    }
}
let sToken = function (res) {
    // console.log(res.config.url, res.data.code, res.data.data)
    if (res.data.code == codeLogin) {
        //需要登录时使用
    }
    setToken(res);
    rmToken(res);
}
export { sToken as setToken };
/* eslint-disable */